package org.huel.backend.service.impl;

import org.huel.backend.domain.entity.AbsencePrediction;
import org.huel.backend.mapper.AbsencePredictionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

/**
 * 缺勤预测服务类
 */
@Service
public class AbsencePredictionService {

    @Autowired
    private AbsencePredictionMapper absencePredictionMapper;

    /**
     * 获取前三名最可能缺勤的学生
     * @return 缺勤预测列表
     */
    public List<AbsencePrediction> getTopThreeAbsencePredictions() {
        return absencePredictionMapper.getTopAbsencePredictions(3);
    }

    /**
     * 根据课程获取前三名最可能缺勤的学生
     * @param courseName 课程名称
     * @return 缺勤预测列表
     */
    public List<AbsencePrediction> getTopThreeAbsencePredictionsByCourse(String courseName) {
        return absencePredictionMapper.getTopAbsencePredictionsByCourse(courseName, 3);
    }

    /**
     * 获取所有课程列表
     * @return 课程名称列表
     */
    public List<String> getAllCourses() {
        return absencePredictionMapper.getAllCourses();
    }

    /**
     * 根据学生ID获取预测信息
     * @param studentId 学生ID
     * @return 预测列表
     */
    public List<AbsencePrediction> getPredictionsByStudentId(String studentId) {
        return absencePredictionMapper.getPredictionsByStudentId(studentId);
    }


}